package com.gistone.commis.mapper;

import com.gistone.commis.entity.FundChange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface FundChangeMapper {
    int deleteByPrimaryKey(Integer ppChangeId);

    int insert(FundChange record);

    int insertSelective(FundChange record);

    FundChange selectByPrimaryKey(Integer ppChangeId);
//    @Select("SELECT count(*) FROM tb_pp_change WHERE pp_id = #{ppId}")
//    int selectByPpId(Integer ppId);

    @Select("SELECT * FROM tb_pp_change WHERE pp_id = #{ppId} and current_auditor_id = #{userId} ")
    FundChange selectByFundIdAndCurrentAuditorId(@Param("ppId") Integer ppId,@Param("userId") Integer userId);

    @Select("SELECT amount FROM tb_pp_change WHERE pp_id = #{ppId} order by pp_change_id desc limit 0,1")
    double getNewlyAmountById(Integer ppId);

    int updateByPrimaryKeySelective(FundChange record);

    int updateByPrimaryKey(FundChange record);


}